/**
 * https://leetcode.cn/problems/pascals-triangle/submissions/545155716/
 * 118.杨辉三角
 * easy 2024.07.09
 * dp
 */

class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> mm;
        vector<int> m;
        for(int i=0;i<numRows;++i){
            m.push_back(1);
            for(int j=1;j<i;++j){
                m.push_back(mm[i-1][j-1]+mm[i-1][j]);
                // cout<<i<<endl;
            }
            if(i)m.push_back(1);
            mm.push_back(m);
            m.clear();
        }
        return mm;
    }
};